*{
    padding: 0;
    margin: 0;
}
ul{
    width: 200px;
    height: 200px;
    margin:200px auto;
    position: relative;
    transform-style: preserve-3d;
    transform-origin: 50% 50%;
    perspective: 20000px;
}
ul li{
    list-style: none;
    width: 200px;
    line-height: 200px;
    text-align: center;
}
ul li:nth-child(1){
    background: red;
    position: absolute;
    transform: rotateX(90deg) translateZ(100px);
}
ul li:nth-child(2){
    background: #4129ff;
    position: absolute;
    transform: rotateX(270deg) translateZ(100px);
}
ul li:nth-child(3){
    background: #d2ff00;
    position: absolute;
    transform: rotateY(90deg) translateZ(100px);
}
ul li:nth-child(4){
    background: #59cfc4;
    position: absolute;
    transform: rotateY(270deg) translateZ(100px);
}
ul li:nth-child(5){
    background: #ff22f3;
    position: absolute;
    transform:translateZ(-100px);
}
ul li:nth-child(6){
    background: #814dff;
    position: absolute;
    transform:translateZ(100px);
}

ul {
    animation: pp 5s linear infinite;
}

@keyframes pp {
    from{
        transform: rotateX(0deg) rotateY(0deg);
    }
    to{
        transform: rotateX(360deg) rotateY(360deg);
    }
}